package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dao.history.AlarmHisMapper;
import com.bbzn.device.client.dataobject.AlarmHis;
import com.bbzn.device.client.dto.history.AlarmHisDTO;
import com.bbzn.device.client.service.AlarmHisService;
import com.bbzn.device.client.utils.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 曾俞钧
 * @Date : 2021/3/29 9:45
 * @Version 1.0
 */
@Service
public class AlarmHisServiceImpl implements AlarmHisService {

    @Resource
    private AlarmHisMapper alarmHisMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return alarmHisMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(AlarmHis record) {
        return alarmHisMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(AlarmHis record) {
        return alarmHisMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(AlarmHis record) {
        return alarmHisMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(AlarmHis record) {
        return alarmHisMapper.insertSelective(record);
    }

    @Override
    public AlarmHis selectByPrimaryKey(Long id) {
        return alarmHisMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(AlarmHis record) {
        return alarmHisMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(AlarmHis record) {
        return alarmHisMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateBatch(List<AlarmHis> list) {
        return alarmHisMapper.updateBatch(list);
    }

    @Override
    public int batchInsert(List<AlarmHis> list) {
        return alarmHisMapper.batchInsert(list);
    }


    @Override
    public PageInfo<AlarmHis> alarmHistroryLimt(AlarmHisDTO alarmHis) {
        List<AlarmHis> alarmHisList = alarmHisMapper.alarmHistroryLimt(alarmHis);
        Integer totalRecord = alarmHisMapper.alarmHisCount(alarmHis);
        PageInfo<AlarmHis> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(alarmHis.getPageNum());
        pageInfo.setPageSize(alarmHis.getPageSize());
        pageInfo.setTotalRecord(totalRecord);
        pageInfo.setResultList(alarmHisList);
        return pageInfo;
    }

    @Override
    public int updateBatchSelective(List<AlarmHis> list) {
        return alarmHisMapper.updateBatchSelective(list);
    }

    @Override
    public int alarmHisCount(AlarmHisDTO record) {
        return alarmHisMapper.alarmHisCount(record);
    }

    @Override
    public List<AlarmHis> alarmHistrorySelective(AlarmHisDTO alarmHis) {
        return alarmHisMapper.alarmHistrorySelective(alarmHis);
    }

    @Override
    public List<AlarmHis> findByAll(AlarmHis alarmHis) {
        return alarmHisMapper.findByAll(alarmHis);
    }

    @Override
    public int deleteByImei(String imei) {
        return alarmHisMapper.deleteByImei(imei);
    }
}












